package cn.ycl.auth.api.user.feign;

import cn.ycl.auth.api.user.domain.User;
import cn.ycl.entity.UserInfoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Service;

/**
 * @author yuanchangliang
 * @date 2022-06-21 09:30
 **/
@Service
public class RemoteUserServiceFallback implements FallbackFactory<RemoteUserService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteUserServiceFallback.class);

    @Override
    public RemoteUserService create(Throwable cause) {
        log.info("调用用户接口失败：{}" + cause.getMessage());
        return new RemoteUserService() {
            @Override
            public UserInfoVO getUserInfo() {
                return null;
            }

            @Override
            public User queryByUserName(String userName) {
                return null;
            }
        };
    }
}
